From: Robert Lipe Date: Mon, 3 Dec 2018 06:37:29 +0000 (-0600) Subject: Warning fixes in jeeps: move use closer to initialization so that the X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~8^2~51^2~11 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=4e1324a1f92301d24c6fbbdac4e5eec2e019974f;p=gpsbabel.git Warning fixes in jeeps: move use closer to initialization so that the test of device is effective, don't set locals before return. --- diff --git a/jeeps/gpsserial.cc b/jeeps/gpsserial.cc index 26343a89b..147f4c8b4 100644 --- a/jeeps/gpsserial.cc +++ b/jeeps/gpsserial.cc @@ -610,8 +610,6 @@ int32 GPS_Serial_Off(gpsdevh* dh) gps_errno = HARDWARE_ERROR; return 0; } - dh = nullptr; - return 1; } diff --git a/mac/libusb/darwin.c b/mac/libusb/darwin.c index 749e09ecc..d52b6b757 100644 --- a/mac/libusb/darwin.c +++ b/mac/libusb/darwin.c @@ -283,9 +283,6 @@ int usb_os_open(usb_dev_handle *dev) usb_device_t **darwin_device; - UInt32 location = *((UInt32 *)dev->device->dev); - UInt32 dlocation; - if (!dev) USB_ERROR(-ENXIO); @@ -304,6 +301,10 @@ int usb_os_open(usb_dev_handle *dev) if ((result = usb_setup_iterator (&deviceIterator)) < 0) return result; + UInt32 location = *((UInt32 *)dev->device->dev); + UInt32 dlocation; + + /* This port of libusb uses locations to keep track of devices. */ while ((darwin_device = usb_get_next_device (deviceIterator, &dlocation)) != NULL) { if (dlocation == location)